Visit the SAP Forum

Languages : English | Dutch | French | Portugese | Italian



INTERVIEW EBOOK
Get 30,000 Interview Questions & Answers in an eBook.

Interview Success Kit - Get Success in Job Interviews



Send your Resume to 6000 Companies
START YOUR WEBSITE
India's Best Web Hosting Company

Dynamic Open SQL – WHERE statement


Home »Dynamic Open SQL » Dynamic Open SQL – WHERE statement


A D V E R T I S E M E N T

S A P - R E S O U R C E S


Get Free SAP Resources:

Are you looking for:
  • SAP Jobs
  • Free SAP eBooks
  • SAP Softwares
  • SAP Tutorials
  • ERP Implementation Examples
Enter Email Address:
(Enter your email address above and we will instantly send you the download link to you, when you confirm your email.)
Search SAP Resources:
  Text Box: 1  REPORT YA002DYN002 .
2  TABLES: SCUSTOM.
3  DATA: ITAB_SCUSTOM LIKE SCUSTOM OCCURS 0 WITH HEADER LINE.
4  DATA: STR_WHERE TYPE TABLE OF EDPLINE.
5  DATA: STR_LINE TYPE EDPLINE.
6  PARAMETERS: NAMELIKE(20) TYPE C DEFAULT 'A' OBLIGATORY.
7  PARAMETERS: OTHERCON(50) TYPE C DEFAULT 'ID BETWEEN 1 AND 99'.
8  CONCATENATE 'NAME LIKE ''' NAMELIKE '%''' INTO STR_LINE.
9  IF OTHERCON <> ''.
10   CONCATENATE STR_LINE 'AND' OTHERCON '' INTO STR_LINE
11   SEPARATED BY SPACE.
12 ENDIF.
13 APPEND STR_LINE TO STR_WHERE.
14 SELECT * FROM SCUSTOM INTO TABLE ITAB_SCUSTOM WHERE (STR_WHERE). η
15 WRITE: / 'CUST ID',
          11 'CUSTOMER NAME',
          40 'STREET ADDRESS',
          59 'CITY',
          75 'COUNTRY'.
16 LOOP AT ITAB_SCUSTOM.
17   WRITE: / ITAB_SCUSTOM-ID,
            11 ITAB_SCUSTOM-NAME,
            40 ITAB_SCUSTOM-STREET,
            59 ITAB_SCUSTOM-CITY,
            75 ITAB_SCUSTOM-COUNTRY.
18 ENDLOOP.
  

Above program is featuring more complex programming techniques. If in the previous program the codes only use one parameter as Dynamic component, in above program the code must implement some additional features to allow the program runs dynamically.




 

This program will allow the user to search a particular customer name and one other search condition which will be executed during runtime. This program will then display all the records from table customer SCUSTOM which matches with the conditions defined by the user.

 

Apart from the usage of Internal Table, the program will also require the usage of Table EDPLINE. This is a special feature in Release 4.6 in its pre-release to allow the construction of string or characters which later will be used within the SELECT statement.

 
  

 

 

 

 

 

 

 

 


 

As any other program, the first requirement is variable and table declaration. This program will be using one internal table to keep all the data “ITAB_SCUSTOM” (Line 3) and one constructible WHERE statement built on a TABLE OF EDPLINE and EDPLINE (Line 4 and 5). EDPLINE will handle all small pieces or components of WHERE statement and the TABLE OF EDPLINE will construct all the pieces or components from EDPLINE into a WHERE string statement which will be used in the WHERE condition in SELECT statement.

For the selection screen, the program will allow the user to input a particular name LIKE which means any number of first character(s) which the user want to search on. And also, the program will allow one other optional selection condition from the user (Line 6 and 7). In this example the default is “A” for the name and “ID BETWEEN 1 and 99” as the other condition.

 
  

 

 

 

 

 

 


 

Once the user click “Execute” or F8 button, the program will start allocating information from the selection screen into EDPLINE which in this example called “STR_LINE” (Line 8). If the user input an additional condition in the selection screen, the program will also add that information into “STR_LINE” (Line 9 – 11).

 

After all the conditions constructed, the information in “STR_LINE” will be appended into “STR_WHERE” as the “TABLE OF EDPLINE” (Line 13) which will be used in the SELECT statement (Line 14).

 

Using that dynamically constructed SELECT statement, the program will display the matching records available in table customer SCUSTOM.

A D V E R T I S E M E N T

discussionDiscussion Center
Discuss
Discuss

Query

Feedback
Yahoo Groups
Y! Group
Sirfdosti Groups
Sirfdosti
Contact Us
Contact
Sign in

User Name:
Password:
Forget password? | Register


INTERVIEW EBOOK

Get 30,000 Interview Questions & Answers in an eBook.

Interview Success Kit - Get Success in Job Interviews


Send your Resume to 6000 Companies

SAP Resources

  • SAP Articles
  • SAP Books
  • SAP Certifications
  • SAP Companies
  • SAP Study Materials
  • SAP Events
  • SAP Faqs
  • SAP Jobs
  • SAP Job Consultants
  • SAP Links
  • SAP News
  • SAP Sample Papers
  • SAP Interview Questions
  • SAP Training Institutes
  •  
    SAP Tutorial

  • Introduction
  • SAP History
  • SAP Facts
  • SAP Tables
  • SAP Function
  • SAP Report
  • Reasons To Use SAP
  • SAP Landscape
  • SAP Transaction Code
  • SAP Lotus Notes Integration
  • Business Connector and XML
  • Enterprise Release 4.7

  • SAP Training Institutes

  • SAP Training Institutes
  • Job Consultants Address
  • SAP Companies Address

  • Business Process Cycle

  • Analyze
  • Design
  • Implement
  • Operate
  • Optimize
  • Skills And Education

  • Logistics Module

  • Sales and Distribution
  • Quality Management
  • Materail Management
  • Plant Maintenance
  • Financial Modules (FI/CO)
  • Project system
  • Production Planning
  • Service Management

  • SAP NetWeaver

  • Introduction
  • Object Model
  • Interoperability
  • Creating Web Apps
  • Java Connector
  • Advantages & Conclusion
  • Life Cycle Management
  • Composite Application Framework

  • SAP Tools

  • SQL Trace Tool
  • SAP CRM
  • SAP SRM
  • SAP SCM
  • SAP ERP
  • SAP BW

  • SAP Modules

  • SAP FI Module
  • SAP CO Module

  • SAP Technical

  • SAP ITS Architecture
  • Financial Management
  • Manufacturing Planning and Execution
  • Customer Order Management
  • Lackbox Processing
  • SD and Financial Accounting Integration
  • SAP - HR (Human Resource)

  • SAP Miscellanous

  • Web Application Server(WAS)
  • Data Archiving
  • Mobile Engine
  • SAP Script
  • SAP Transactions
  • SAP Business Warehouse(BW)

  • SAP Reference

  • SAP Facts
  • SAP Tables
  • SAP Function
  • SAP Report
  • SAP Landscape

  • SAP Others

  • SAP Treasury
  • SAP Finance
  • SAP WAS
  • SAP Data Archiving
  • SAP ALE
  • SAP EDI
  • SAP Exchange
  • SAP X-APPS
  • SAP Applications Components
  • SAP Software
  • Dunning
  • SAP IDES
  • SAP Payroll Basics
  • SAP BASIS and Security Authorization
  • SAP Backup
  • SAP Router

  • ABAP Tutorials

  • Introduction
  • ABAP Transaction
  • ABAP Function
  • ABAP File Processing
  • ABAP Objects
  • ABAP Syntax
  • ABAP Queries
  • SAPMail Using ABAP
  • ABAP Programming Hints

  • SAP Projects & Codes

  • Finding the user-exits
  • Purchase Order Display
  • Batch Input
  • Dynamic Open SQL
  • Creating Extract Dataset
  • Reading database tables
  • Load table from a UNIX file
  • Create subscreen

  • SAP Resources

  • SAP Books
  • SAP Links

  • Interview Question



  • Common Interview Que.
  • ABAP Interview Que.
  • ERP Interview Que.
  • HR Interview Que.
  • MM Interview Que.
  • PP Interview Que.
  • ALE Interview Que.
  • EDI Interview Que.
  • Basis Interview Questions
  • SAP-SD Interview Questions
  • FI&CO Interview Questions
  • BW Interview Questions
  • CRM Interview Questions
  • Interview Questions

  • Careers at SAP

  • Careers in SAP (SAP Jobs)
  • Advertise
  •